
package guoan.domain;

import guoan.core.jodaJson.DateTimeYYYYMMDDHHMMSSSerializer;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * 自定义文档信息
 * 
 */
@Entity
public class Adv implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID 自动增长
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 名称
     */
    private String title;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeYYYYMMDDHHMMSSSerializer.class)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @Column(name = "create_time")
    private DateTime createTime;

    /**
     * 内容
     */
    private String content;

    /**
     * 简介
     */
    private String info;

    /**
     * 文章类型
     */
    @ManyToOne()
    @JoinColumn(name = "adv_type_id")
    private AdvType advType;

    /**
     * 关键词
     */
    @Column(name = "key_name")
    private String keyName;

    /**
     * 排序ID
     */
    @Column(name = "order_id")
    private Long orderId;

    /**
     * 封面地址
     */
    @Column(name = "img_url")
    private String imgUrl;

    /**
     * 是否显示封面
     */
    @Column(name = "img_show")
    private Long imgShow;
    /**
     * 外联地址
     */
    @Column(name = "w_url")
    private String wUrl;

    /**
     * 类型(文字,图片)
     */
    private String type;
    /**
     * 模版ID
     */
    @OneToOne()
    @JoinColumn(name = "media_id")
    private Media media;

    public Long getId(){
        return id;
    }

    public void setId(Long id){
        this.id = id;
    }

    public String getContent(){
        return content;
    }

    public void setContent(String content){
        this.content = content;
    }

    public DateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(DateTime createTime){
        this.createTime = createTime;
    }

    public String getTitle(){
        return title;
    }

    public void setTitle(String title){
        this.title = title;
    }

    public AdvType getAdvType(){
        return advType;
    }

    public void setAdvType(AdvType advType){
        this.advType = advType;
    }

    public Long getOrderId(){
        return orderId;
    }

    public void setOrderId(Long orderId){
        this.orderId = orderId;
    }

    public String getImgUrl(){
        return imgUrl;
    }

    public void setImgUrl(String imgUrl){
        this.imgUrl = imgUrl;
    }

    public Long getImgShow(){
        return imgShow;
    }

    public void setImgShow(Long imgShow){
        this.imgShow = imgShow;
    }

    public String getwUrl(){
        return wUrl;
    }

    public void setwUrl(String wUrl){
        this.wUrl = wUrl;
    }

    public String getType(){
        return type;
    }

    public void setType(String type){
        this.type = type;
    }

    public String getInfo(){
        return info;
    }

    public void setInfo(String info){
        this.info = info;
    }

    public Media getMedia(){
        return media;
    }

    public void setMedia(Media media){
        this.media = media;
    }

    public String getKeyName(){
        return keyName;
    }

    public void setKeyName(String keyName){
        this.keyName = keyName;
    }

}